package com.weixin.pojo;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.weixin.util.serializer.Date2LongSerializer;
import org.hibernate.annotations.DynamicUpdate;

import com.weixin.enums.OrderStatusEnum;
import com.weixin.enums.PayStatusEnum;

import lombok.Data;

/**
 * 订单表
 * @author Code generator by CJunGod
 *
 */
@Data
@Entity
@DynamicUpdate
@Table(name = "order_master")
public class OrderMaster{
    /**
    * 订单ID
    */
	@Id
    @Column(name = "order_id")
    private String orderId;

    /**
    * 买家名字
    */
    @Column(name = "buyer_name")
    private String buyerName;

    /**
    * 买家电话
    */
    @Column(name = "buyer_phone")
    private String buyerPhone;

    /**
    * 买家地址
    */
    @Column(name = "buyer_address")
    private String buyerAddress;

    /**
    * 买家微信openId
    */
    @Column(name = "buyer_openid")
    private String buyerOpenid;

    /**
    * 订单总金额
    */
    @Column(name = "order_amount")
    private BigDecimal orderAmount;

    /**
    * 订单状态，默认0新下单
    */
    @Column(name = "order_status")
    private Integer orderStatus = OrderStatusEnum.NEW.getCode();

    /**
    * 支付状态，默认0未支付
    */
    @Column(name = "pay_status")
    private Integer payStatus = PayStatusEnum.WAIT.getCode();

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @JsonSerialize(using = Date2LongSerializer.class)
    private Date createTime = new Date();
    
    /**
    * 修改时间
    */
    @Column(name = "update_time")
    @JsonSerialize(using = Date2LongSerializer.class)
    private Date updateTime = new Date();

}
